<?php
/**
 * Created by PhpStorm.
 * User: zl
 * Date: 2017/6/27
 * Time: 10:30
 */
    require_once('../Common.php');
    require_once('../SQLBase.php');
    class Standard{

        function getFeeStandard($cityID, $m){
            $conn = new SQLBase();
            $query = "SELECT * FROM hotel_money WHERE city_ID = '$cityID'";
            $r = $conn->queryData($query);
            $return_array = array();
            if($r){
                $return_array['state'] = 1;
                $row = $r->fetch_array();
                $fire_time = $row['fire_time'];
                $temp = explode(',', $fire_time);
                if(in_array($m, $temp)){
                    $return_array['hotel'] = array('bureau'=>$row['bureau_fire'], 'other'=>$row['others_fire'], 'is_fire'=>1);
                }
                else{
                    $return_array['hotel'] = array('bureau'=>$row['bureau_light'], 'other'=>$row['others_light'], 'is_fire'=>0);
                }
            }
            else{
                $return_array['state'] = 0;
            }
            return $return_array;
        }

        function getOilStandard(){
            $conn = new SQLBase();
            $query = "SELECT * FROM oil_fee";
            $r = $conn->queryData($query);
            $result_array = array();
            if($r){
                $result_array['state'] = 1;
                $row = $r->fetch_array();
                $result_array['oil'] = array('count'=>$row['count'], 'price'=>$row['price']);
            }
            else{
                $result_array['state'] = 0;
            }
            return $result_array;
        }

        function getHotelAndSubsidy(){
            $query = "SELECT * FROM public_expense";
            $conn = new SQLBase();
            $r = $conn->queryData($query);
            $result_array = array();
            if($r){
                $result_array['state'] = 1;
                $row = $r->fetch_array();
                $result_array['food_subsidy'] = array('local_food'=>$row['local_food_subsidy'], 'local_subsidy'=>$row['local_public_expense'], 'province_food'=>$row['province_food_subsidy'],
                    'province_subsidy'=>$row['province_public_expense'], 'out_food'=>$row['outprovince_food_subsidy'], 'out_subsidy'=>$row['outprovice_public_expense']);
            }
            else{
                $result_array['state'] = 0;
            }
            return $result_array;
        }


    }



?>